<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>系统</title>
<%@include file="/WEB-INF/jsp/include/easyui_1_5_3.jsp"%>
<script type="text/javascript" src="${path}/js/business/kvComboBox.js"></script>

<script type="text/javascript">
	//请求地址
	var url;
	//提示消息
	var mesTitle;
	
	//页面加载后执行
	$(function(){
// 		unitInfoComboTree('#unit_id_form',path+'/sysUnitInfo/getBy');
		kvComboBox('#supplier_class_form',path+'/sysDict/kvByType?pid=供应商类型');
		kvComboBox('#supplier_type_form',path+'/sysDict/kvByType?pid=供应商性质');
		
    });
	//添加用户信息
	function addPsPhysicSupplierDict(){
		$('#dlg').dialog('open').dialog('setTitle','新增');
		$('#fm').form('clear');
		url=path+"/psPhysicSupplierDict/add";
		mesTitle = '新增成功';
	}
	
	//编辑用户信息
 	function editPsPhysicSupplierDict(){
	 	var row = $('#datagrid').datagrid('getSelected');
	 	if (row){
	 		var id = row.id;
		 	$('#dlg').dialog('open').dialog('setTitle','编辑');
		 	$('#fm').form('load',row);
		 	url = path+"/psPhysicSupplierDict/modify?id="+id;
		 	mesTitle = '编辑成功';
	 	}else{
	 		$.messager.alert('提示', '请选择要编辑的记录！', 'error');
	 	}
	}
 	
	//删除用信息
 	function deletePsPhysicSupplierDict(){
	 	var row = $('#datagrid').datagrid('getSelected');
	 	if (row){
	 		var id = row.id;
		 	$('#dlg_delete').dialog('open').dialog('setTitle','删除');
		 	$('#fmdelete').form('load',row);
		 	url = path+"/psPhysicSupplierDict/delete?id="+id;
		 	mesTitle = '删除成功';
	 	}else{
	 		$.messager.alert('提示', '请选择要删除的记录！', 'error');
	 	}
	}
 	
	//保存添加、修改内容
	function savePsPhysicSupplierDict(){
	 	$('#fm').form('submit',{
		 	url: url,
		 	onSubmit: function(){
		 		return $(this).form('validate');
		 	},
			success: function(result){
				/* console.info(result); */
				var result = eval('('+result+')');
				if (result.success){
				 	$('#dlg').dialog('close'); 
				 	$('#datagrid').datagrid('reload'); 
				} else {
					 mesTitle = '新增失败';
				}
				$.messager.show({ 
					timeout:5000,
					showType:'slide',
					width: 250,
					height:'30%',  
					style:{  
					    left:'',  
					    right:0,  
					    top:'',  
					    bottom:'0',
					    position:'fixed'//元素定位方式：fixed固定。 默认:absolute绝对定位 
					},
					title: mesTitle,
					msg: result.msg
				});
			}
	 	});
	}	
	
	//提交删除内容
	function savePsPhysicSupplierDict_del(){
	 	$('#fmdelete').form('submit',{
		 	url: url,
		 	onSubmit: function(){
		 		return $(this).form('validate');
		 	},
			success: function(result){
				/* console.info(result); */
				var result = eval('('+result+')');
				if (result.success){
				 	$('#dlg_delete').dialog('close'); 
				 	$('#datagrid').datagrid('reload'); 
				} else {
					 mesTitle = '新增失败';
				}
				$.messager.show({
					timeout:5000,
					showType:'slide',
					width: 250,
					height:'30%',  
					style:{  
					    left:'',  
					    right:0,  
					    top:'',  
					    bottom:'0',
					    position:'fixed'//元素定位方式：fixed固定。 默认:absolute绝对定位 
					},
					title: mesTitle,
					msg: result.msg
				});
			}
	 	});
	}

	//快速查询
 	function searchPsPhysicSupplierDictQ(){
	 	$("#datagrid").datagrid("load", {
            "username": $('#search_username').val()
        });
	}
	
	//查询
 	function searchPsPhysicSupplierDict(){
		$('#dlgsearch').dialog('open').dialog('setTitle','查询');
		$('#fmsearch').form('clear');
		url = path+"/user/searchUser";
		mesTitle = '查询成功';
	}
	
	//刷新
	function reload(){
		$('#datagrid').datagrid('reload'); 
	}
</script>

</head>
<body class="easyui-layout" fit="true">
	<div region="center" border="false" style="overflow: hidden;">
		<!-- 信息列表 title="管理" -->
		<table id="datagrid" class="easyui-datagrid" 
		    fit="true"
			url="${path}/psPhysicSupplierDict/datagrid" 
			toolbar="#toolbar" 
			pagination="true"
			fitColumns="false" 
			singleSelect="true" 
			rownumbers="true"
			striped="true"
			border="false" 
			nowrap="false">
			<thead>
				<tr>
					<!-- <th field="ck" checkbox="true"></th> -->
					<th field="id" width="100" hidden='true'>id</th>
					<th field="supplier_number" width="100">供应商编码</th>
					<th field="supplier" width="100">供应商名称</th>
					<th field="mnemonic" width="100">拼音字头码</th>
					<th field="supplier_class" width="100">供应商类别</th>
					<th field="supplier_type" width="100">供应商性质</th>
					<th field="relation_man" width="100">联系人</th>
					<th field="relation_tel" width="100">联系电话</th>
					<th field="email" width="100">电子邮箱</th>
					<th field="weixin" width="100">微信</th>
					<th field="qq" width="100">qq号码</th>
				</tr>
			</thead>
		</table>

		<!-- 按钮 -->
		<div id="toolbar" style="padding:3px">
			<a href="javascript:void(0);" class="easyui-linkbutton"
				iconCls="icon-reload" plain="true" onclick="reload();">刷新</a>
			<a href="javascript:void(0);" class="easyui-linkbutton"
				iconCls="icon-add" plain="true" onclick="addPsPhysicSupplierDict();">新增</a> 
			<a href="javascript:void(0);" class="easyui-linkbutton"
				iconCls="icon-edit" plain="true" onclick="editPsPhysicSupplierDict();">编辑</a> 
			<a href="javascript:void(0);" class="easyui-linkbutton"
				iconCls="icon-remove" plain="true" onclick="deletePsPhysicSupplierDict();">删除</a>
			<span>用户名:</span>
			<input name="search_username" id="search_username" value="" size=10 /> 
  			<a href="javascript:searchPsPhysicSupplierDictQ()" class="easyui-linkbutton" data-options="iconCls:'icon-search'">查询</a> 
			<a href="javascript:void(0);" class="easyui-linkbutton"
				iconCls="icon-jright" plain="true" onclick="searchPsPhysicSupplierDict();">更多查询</a>
		</div>

		<!-- 添加/修改对话框 -->
		<div id="dlg" class="easyui-dialog"
			style="width:600px;height:400px;padding:30px 20px" closed="true"
			buttons="#dlg_AM-buttons">
			<form id="fm" method="post" novalidate>
				<table>
					<tr>
						<td>
							<label>供应商编码:</label>
						</td>
						<td>
							<input name="supplier_number" class="easyui-validatebox" required="true">
						</td>
						<td>
							<label>供应商名称:</label>
						</td>
						<td>
							<input name="supplier" class="easyui-validatebox" required="true">
						</td>
					</tr>
<!-- 					<tr> -->
<!-- 						<td> -->
<!-- 							<label>id:</label> -->
<!-- 						</td> -->
<!-- 						<td> -->
<!-- 							<input name="id" class="easyui-validatebox" required="true"> -->
<!-- 						</td> -->
<!-- 						<td> -->
<!-- 							<label>拼音字头码:</label> -->
<!-- 						</td> -->
<!-- 						<td> -->
<!-- 							<input name="mnemonic" class="easyui-validatebox" required="true"> -->
<!-- 						</td> -->
<!-- 					</tr> -->
					<tr>
						<td>
							<label>供应商类别:</label>
						</td>
						<td>
<!-- 							<input name="supplier_class" class="easyui-validatebox" required="true"> -->
							<select id="supplier_class_form" name="supplier_class" class="easyui-combotree" required="true" />
						</td>
						<td>
							<label>供应商性质:</label>
						</td>
						<td>
<!-- 							<input name="supplier_type" class="easyui-validatebox" required="true"> -->
							<select id="supplier_type_form" name="supplier_type" class="easyui-combotree" required="true" />
						</td>
					</tr>
					<tr>
						<td>
							<label>联系人:</label>
						</td>
						<td>
							<input name="relation_man" class="easyui-validatebox" required="true">
						</td>
						<td>
							<label>联系电话:</label>
						</td>
						<td>
							<input name="relation_tel" class="easyui-validatebox" required="true">
						</td>
					</tr>
					<tr>
						<td>
							<label>电子邮箱:</label>
						</td>
						<td>
							<input name="email" class="easyui-validatebox" required="true">
						</td>
						<td>
							<label>微信:</label>
						</td>
						<td>
							<input name="weixin" class="easyui-validatebox" required="true">
						</td>
					</tr>
					<tr>
						<td>
							<label>qq号码:</label>
						</td>
						<td>
							<input name="qq" class="easyui-validatebox" required="true">
						</td>
				</table>
			</form>
		</div>
		
		<!-- 添加/修改对话框按钮 -->
		<div id="dlg_AM-buttons">
			<a href="javascript:void(0)" class="easyui-linkbutton c6"
				iconCls="icon-ok" onclick="savePsPhysicSupplierDict()" style="width:90px">保存</a> 
				<a href="javascript:void(0)" class="easyui-linkbutton"
				iconCls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')"
				style="width:90px">取消</a>
		</div>
		
		<!-- 删除对话框 -->
		<div id="dlg_delete" class="easyui-dialog"
			style="width:300px;height:200px;padding:30px 20px" closed="true"
			buttons="#dlg-del-buttons">
			<div class="ftitle">请谨慎操作</div>
			<form id="fmdelete" method="post" novalidate>
					<label>确定删除吗？</label>
			</form>
		</div>
		
		<!-- 删除对话框按钮 -->
		<div id="dlg-del-buttons">
			<a href="javascript:void(0)" class="easyui-linkbutton c6"
				iconCls="icon-ok" onclick="savePsPhysicSupplierDict_del()" style="width:90px">删除</a> 
			<a href="javascript:void(0)" class="easyui-linkbutton"
				iconCls="icon-cancel" onclick="javascript:$('#dlg_delete').dialog('close')"
				style="width:90px">取消</a>
		</div>
		
		<!-- 查询对话框 -->
		<div id="dlgsearch" class="easyui-dialog"
			style="width:400px;height:380px;padding:30px 20px" closed="true"
			buttons="#dlg_query-buttons">
			<form id="fmsearch" method="post" novalidate>
				<label>权限:</label>  
                    <span id="span1" style="display: inline-block;"></span>  
                </div>
			</form>
		</div>
		
		<!-- 查询对话框按钮 -->
		<div id="dlg_query-buttons">
			<a href="javascript:void(0)" class="easyui-linkbutton c6"
				iconCls="icon-ok" onclick="searchPsPhysicSupplierDict()" style="width:90px">查询</a> 
				<a href="javascript:void(0)" class="easyui-linkbutton"
				iconCls="icon-cancel" onclick="javascript:$('#dlgsearch').dialog('close')"
				style="width:90px">取消</a>
		</div>
		
	</div>
</body>
</html>
